//
//  MusicThiTableViewCell.m
//  A_program
//
//  Created by 杨利佳 on 15/5/25.
//  Copyright (c) 2015年 BayMax. All rights reserved.
//

#import "MusicThiTableViewCell.h"

@implementation MusicThiTableViewCell

- (void)dealloc
{
    [_showImage release];
    [_title release];
    [_nickname release];
    [_playtimes release];
    [_likes release];
    [_comments release];
    [_duration release];
    [_down release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self createSubviews];
    }
    return self;
}


- (void)createSubviews
{
    self.contentView.backgroundColor = [UIColor colorWithRed:0.8 green:0.8 blue:0.8 alpha:0.8];
    
    UIView *backgroungView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 200)];
    backgroungView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:backgroungView];
    [backgroungView release];
    
    self.showImage = [[UIImageView alloc] initWithFrame:CGRectMake(5, 30, 80, 80)];
    [_showImage.layer setCornerRadius:40];
    _showImage.layer.masksToBounds = YES;
    [backgroungView addSubview:_showImage];
    [_showImage release];
    
    self.title = [[UILabel alloc] initWithFrame:CGRectMake(85, 20, [UIScreen mainScreen].bounds.size.width - 85, 80)];
    _title.numberOfLines = 0;
    [backgroungView addSubview:_title];
    [_title release];
    
    self.nickname = [[UILabel alloc] initWithFrame:CGRectMake(85, 100, 200, 20)];
    _nickname.textColor = [UIColor grayColor];
    _nickname.font = [UIFont boldSystemFontOfSize:14];
    [backgroungView addSubview:_nickname];
    [_nickname release];
   
    
    UIImageView *image1 = [[UIImageView alloc] initWithFrame:CGRectMake(80, 125, 30, 30)];
    image1.image = [UIImage imageNamed:@"play1.png"];
    [backgroungView addSubview:image1];
    [image1 release];

    
    self.playtimes = [[UILabel alloc] initWithFrame:CGRectMake(105, 130, 40, 20)];
    _playtimes.textColor = [UIColor lightGrayColor];
    _playtimes.font = [UIFont boldSystemFontOfSize:11];
    [backgroungView addSubview:_playtimes];
    [_playtimes release];
   
    
    UIImageView *image2 = [[UIImageView alloc] initWithFrame:CGRectMake(145, 130, 20, 20)];
    image2.image = [UIImage imageNamed:@"fav.png"];
    [backgroungView addSubview:image2];
    [image2 release];
    
    
    self.likes = [[UILabel alloc] initWithFrame:CGRectMake(165, 130, 40, 20)];
    _likes.textColor = [UIColor lightGrayColor];
    _likes.font = [UIFont boldSystemFontOfSize:11];
    [backgroungView addSubview:_likes];
    [_likes release];
    

    UIImageView *image3 = [[UIImageView alloc] initWithFrame:CGRectMake(200, 130, 20, 20)];
    image3.image = [UIImage imageNamed:@"coment.png"];
    [backgroungView addSubview:image3];
    [image3 release];
    
    self.comments = [[UILabel alloc] initWithFrame:CGRectMake(220, 130, 40, 20)];
    _comments.textColor = [UIColor lightGrayColor];
    _comments.font = [UIFont boldSystemFontOfSize:11];
    [backgroungView addSubview:_comments];
    [_comments release];
    

    UIImageView *image4 = [[UIImageView alloc] initWithFrame:CGRectMake(260, 130, 20, 20)];
    image4.image = [UIImage imageNamed:@"time.png"];
    [backgroungView addSubview:image4];
    [image4 release];
    
    self.duration = [[UILabel alloc] initWithFrame:CGRectMake(280, 130, 40, 20)];
    _duration.textColor = [UIColor lightGrayColor];
    _duration.font = [UIFont boldSystemFontOfSize:11];
    [backgroungView addSubview:_duration];
    [_duration release];

}

- (void)downAction:(id)sender
{
    [sender setImage:[UIImage imageNamed:@"check.png"] forState:UIControlStateNormal];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
